package com.lyn.seckill.common;

public class ResponseReturnType {

    // 表明对应请求的响应处理结果，“Success”/“fail”
    private String status;

    // Success：返回前端需要的数据
    // Fail：返回通用的错误码格式数据
    private Object data;

    // 定义一个通用的创建方法

    public static ResponseReturnType create(Object result) {
        return ResponseReturnType.create(result,"success");
    }

    public static ResponseReturnType create(Object result, String status) {
        ResponseReturnType responseReturnType = new ResponseReturnType();
        responseReturnType.setStatus(status);
        responseReturnType.setData(result);
        return responseReturnType;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
